package contegor.scire.core;

import java.util.Collection;
import java.util.List;

/**
 * {@link Task} that has subsequent {@link Task}s, because they have been added to it (see {@link WithSubsequentsExtensible}) 
 * or because its processing produce them.
 * 
 * This subsequent {@link Task}s will be executed after this one and will use its results for their processing.
 * 
 * It's not the same as {@link WithConsequences}. {@link WithSubsequentTasks} don't need additional {@link Task}s
 * to fulfill their work, but it's possible to chain it with others, so all together give a compound {@link Task}
 * with a higher level of abstraction.
 * 
 * @version $Revision$
 * @author  Héctor Cirbián Pousa ($Author$)
 */
@Version("$Id$")
public interface WithSubsequentTasks<I,O> extends Task<I> {

  /**
   * <b>Internal use only method. Don't call it directly.</b>
   * Return a list of all subsequent {@link NeedsPrecedent} {@link Task}s added to this.
   */
  public List<? extends NeedsPrecedent<? super I,O>> getSubsequentTasks();

  /**
   * <b>Internal use only method. Don't call it directly.</b>
   * Returns a {@link List} with the results needed by the subsequent {@link Task}s.
   * It must have the same number of elements and this must be in sync with those in the {@link List}
   * returned by {@link #getSubsequentTasks()}, so first {@link ReturnPoint} will correspond to first
   * subsequent {@link Task}, second to second, and so on.
   */
  public List<? extends Collection<I>> getResultsForSubsequentTasks();

  /**
   * <b>Internal use only method. Don't call it directly.</b>
   * Returns a {@link List} with this subsequent {@link Task}s {@link ReturnPoint}s. It must have the same number
   * of elements and this must be in sync with those in the {@link List} returned by {@link #getSubsequentTasks()},
   * so first {@link ReturnPoint} will correspond to first subsequent {@link Task}, second to second, and so on.
   */
  public List<? extends ReturnPoint<? super O>> getSubsequentTasksReturnPoints();
}
